/**
 * <copyright>
 * </copyright>
 *
 */
package de.sabram.upb.specs.lido.impl;

import de.sabram.upb.specs.lido.CompPart;
import de.sabram.upb.specs.lido.InheritOpt;
import de.sabram.upb.specs.lido.LidoPackage;
import de.sabram.upb.specs.lido.SymbolDefId;

import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.common.notify.NotificationChain;

import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.InternalEObject;

import org.eclipse.emf.ecore.impl.ENotificationImpl;

/**
 * <!-- begin-user-doc -->
 * An implementation of the model object '<em><b>Symbol Def Id</b></em>'.
 * <!-- end-user-doc -->
 * <p>
 * The following features are implemented:
 * <ul>
 *   <li>{@link de.sabram.upb.specs.lido.impl.SymbolDefIdImpl#getName <em>Name</em>}</li>
 *   <li>{@link de.sabram.upb.specs.lido.impl.SymbolDefIdImpl#getInheritOpt <em>Inherit Opt</em>}</li>
 *   <li>{@link de.sabram.upb.specs.lido.impl.SymbolDefIdImpl#getCompPart <em>Comp Part</em>}</li>
 * </ul>
 * </p>
 *
 * @generated
 */
public class SymbolDefIdImpl extends SymCompSpecImpl implements SymbolDefId
{
  /**
   * The default value of the '{@link #getName() <em>Name</em>}' attribute.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #getName()
   * @generated
   * @ordered
   */
  protected static final String NAME_EDEFAULT = null;

  /**
   * The cached value of the '{@link #getName() <em>Name</em>}' attribute.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #getName()
   * @generated
   * @ordered
   */
  protected String name = NAME_EDEFAULT;

  /**
   * The cached value of the '{@link #getInheritOpt() <em>Inherit Opt</em>}' containment reference.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #getInheritOpt()
   * @generated
   * @ordered
   */
  protected InheritOpt inheritOpt;

  /**
   * The cached value of the '{@link #getCompPart() <em>Comp Part</em>}' containment reference.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #getCompPart()
   * @generated
   * @ordered
   */
  protected CompPart compPart;

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  protected SymbolDefIdImpl()
  {
    super();
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  protected EClass eStaticClass()
  {
    return LidoPackage.Literals.SYMBOL_DEF_ID;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public String getName()
  {
    return name;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public void setName(String newName)
  {
    String oldName = name;
    name = newName;
    if (eNotificationRequired())
      eNotify(new ENotificationImpl(this, Notification.SET, LidoPackage.SYMBOL_DEF_ID__NAME, oldName, name));
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public InheritOpt getInheritOpt()
  {
    return inheritOpt;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public NotificationChain basicSetInheritOpt(InheritOpt newInheritOpt, NotificationChain msgs)
  {
    InheritOpt oldInheritOpt = inheritOpt;
    inheritOpt = newInheritOpt;
    if (eNotificationRequired())
    {
      ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, LidoPackage.SYMBOL_DEF_ID__INHERIT_OPT, oldInheritOpt, newInheritOpt);
      if (msgs == null) msgs = notification; else msgs.add(notification);
    }
    return msgs;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public void setInheritOpt(InheritOpt newInheritOpt)
  {
    if (newInheritOpt != inheritOpt)
    {
      NotificationChain msgs = null;
      if (inheritOpt != null)
        msgs = ((InternalEObject)inheritOpt).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - LidoPackage.SYMBOL_DEF_ID__INHERIT_OPT, null, msgs);
      if (newInheritOpt != null)
        msgs = ((InternalEObject)newInheritOpt).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - LidoPackage.SYMBOL_DEF_ID__INHERIT_OPT, null, msgs);
      msgs = basicSetInheritOpt(newInheritOpt, msgs);
      if (msgs != null) msgs.dispatch();
    }
    else if (eNotificationRequired())
      eNotify(new ENotificationImpl(this, Notification.SET, LidoPackage.SYMBOL_DEF_ID__INHERIT_OPT, newInheritOpt, newInheritOpt));
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public CompPart getCompPart()
  {
    return compPart;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public NotificationChain basicSetCompPart(CompPart newCompPart, NotificationChain msgs)
  {
    CompPart oldCompPart = compPart;
    compPart = newCompPart;
    if (eNotificationRequired())
    {
      ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, LidoPackage.SYMBOL_DEF_ID__COMP_PART, oldCompPart, newCompPart);
      if (msgs == null) msgs = notification; else msgs.add(notification);
    }
    return msgs;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public void setCompPart(CompPart newCompPart)
  {
    if (newCompPart != compPart)
    {
      NotificationChain msgs = null;
      if (compPart != null)
        msgs = ((InternalEObject)compPart).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - LidoPackage.SYMBOL_DEF_ID__COMP_PART, null, msgs);
      if (newCompPart != null)
        msgs = ((InternalEObject)newCompPart).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - LidoPackage.SYMBOL_DEF_ID__COMP_PART, null, msgs);
      msgs = basicSetCompPart(newCompPart, msgs);
      if (msgs != null) msgs.dispatch();
    }
    else if (eNotificationRequired())
      eNotify(new ENotificationImpl(this, Notification.SET, LidoPackage.SYMBOL_DEF_ID__COMP_PART, newCompPart, newCompPart));
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs)
  {
    switch (featureID)
    {
      case LidoPackage.SYMBOL_DEF_ID__INHERIT_OPT:
        return basicSetInheritOpt(null, msgs);
      case LidoPackage.SYMBOL_DEF_ID__COMP_PART:
        return basicSetCompPart(null, msgs);
    }
    return super.eInverseRemove(otherEnd, featureID, msgs);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public Object eGet(int featureID, boolean resolve, boolean coreType)
  {
    switch (featureID)
    {
      case LidoPackage.SYMBOL_DEF_ID__NAME:
        return getName();
      case LidoPackage.SYMBOL_DEF_ID__INHERIT_OPT:
        return getInheritOpt();
      case LidoPackage.SYMBOL_DEF_ID__COMP_PART:
        return getCompPart();
    }
    return super.eGet(featureID, resolve, coreType);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public void eSet(int featureID, Object newValue)
  {
    switch (featureID)
    {
      case LidoPackage.SYMBOL_DEF_ID__NAME:
        setName((String)newValue);
        return;
      case LidoPackage.SYMBOL_DEF_ID__INHERIT_OPT:
        setInheritOpt((InheritOpt)newValue);
        return;
      case LidoPackage.SYMBOL_DEF_ID__COMP_PART:
        setCompPart((CompPart)newValue);
        return;
    }
    super.eSet(featureID, newValue);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public void eUnset(int featureID)
  {
    switch (featureID)
    {
      case LidoPackage.SYMBOL_DEF_ID__NAME:
        setName(NAME_EDEFAULT);
        return;
      case LidoPackage.SYMBOL_DEF_ID__INHERIT_OPT:
        setInheritOpt((InheritOpt)null);
        return;
      case LidoPackage.SYMBOL_DEF_ID__COMP_PART:
        setCompPart((CompPart)null);
        return;
    }
    super.eUnset(featureID);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public boolean eIsSet(int featureID)
  {
    switch (featureID)
    {
      case LidoPackage.SYMBOL_DEF_ID__NAME:
        return NAME_EDEFAULT == null ? name != null : !NAME_EDEFAULT.equals(name);
      case LidoPackage.SYMBOL_DEF_ID__INHERIT_OPT:
        return inheritOpt != null;
      case LidoPackage.SYMBOL_DEF_ID__COMP_PART:
        return compPart != null;
    }
    return super.eIsSet(featureID);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public String toString()
  {
    if (eIsProxy()) return super.toString();

    StringBuffer result = new StringBuffer(super.toString());
    result.append(" (name: ");
    result.append(name);
    result.append(')');
    return result.toString();
  }

} //SymbolDefIdImpl
